<template>
  <view class="main">
    <view class="part1">
		<view class="ptxt1">下单记录</view>
		<view class="ptxt2">订单 <text class="ptxt3">{{total}}</text></view>
	</view> 
	
	   <view class="part2">
		 <view class="item1" v-for="(item,index) in orderlist" @click="showorder(item.id)">
		   <view class="item1-1">
			 <view class="itxt2">【{{item.ptype}}】</view>
			 <view class="itxt1">{{item.total_price}}￥</view>
			 <block v-if="item.step==1">
			 <view class="itxt8">待接单</view>
			 <image src="https://ppp.new.zeroitem.cn/ppp/sm1.png" class="img1"></image>
			 </block>
			 <block v-if="item.step>1">
			 <view class="itxt8">{{item.pname}}</view>
			 <image :src="item.pavatar" class="img1"></image>
			 </block>			 
			 
			 
		   </view>
		   <view class="item1-2">
			 <view class="itxt3">
			   <view class="itxt3-1">
				 <image src="https://ppp.new.zeroitem.cn/ppp/tip2.png" class="img3"></image> 
				  <view class="it3-1">
					<view>{{item.pdate}}</view> 
					<view>{{item.ptime}}</view>  
				  </view>
			   </view> 
			   <view class="itxt3-2">
			     <image src="https://ppp.new.zeroitem.cn/ppp/sm2.png" class="img3"></image> 
				  <view class="it3-1">
					{{item.jtdz}}
				  </view>				   
			   </view> 
			 </view>
				<image src="https://ppp.new.zeroitem.cn/ppp/sm3.png" class="img2"></image>
		   </view>
		   <view class="item1-3">
			   <view class="itxt4">订单号：{{item.ordersn}}</view>
			   <view class="itxt5" v-if="item.step==1">待接单</view>
			   <view class="itxt5 ibg" v-if="item.step==2">已接单</view>
			   <view class="itxt5 ibg" v-if="item.step==3">已开始</view>
			   <view class="itxt5 ibg" v-if="item.step==4">已提交</view>
			   <view class="itxt5" v-if="item.step==5">待评价</view>
			   <view class="itxt5 ibg" v-if="item.step==6">已评价</view>
		   </view>
		 </view> 
	   </view>	
  </view>
</template>
<script>
	import {
		mapGetters,
		mapActions
	} from 'vuex'
	import {
		toLogin
	} from '@/utils/login'
	import {
	   getorderlist
	} from '@/api/ppp'	
	import {
		loadingFun,
		menuJump
	} from '@/utils/tools'	
	
	import {
		loadingType
	} from '@/utils/type'
		
	const app = getApp()
	export default {
	    data() {
	        return {
	         orderlist:[],
			 total:0
	        }
	    },
		onShow(){
	     this.getorderlist();
		},
	    methods: {
			showorder(id){
			  uni.navigateTo({
			  	url:"/pages/ppp/order/order1?oid="+id
			  })	
			 },
			 async getorderlist(){
			  const{
			  code,
			  msg,
			  data
			  }= await getorderlist({}); 
		   if(code==1){
			 this.orderlist=data.list; 
			 this.total=data.total;  
		   }
		 }
	    },
		computed: {
			...mapGetters(['isLogin']),
		}
	}
</script>
<style>
	@import "./orderlist.css";	
</style>
